/**
 * 话题回复的模型
 */

var mongoose = require('../config/db');

var replySchema = new mongoose.Schema({
    //回复内容
    content: {
        type: String
    },
    //回复用户
    user: {
        type: 'ObjectId',
        ref: "user"
    },
    //对应话题
    topic: {
        type: 'ObjectId',
        ref: 'topic'
    },
    //回复时间
    replyTime: {
        type: Date,
        default: Date.now
    },
    //楼层数
    stair: {
        type: Number
    },
    //包含点赞的数据, 点赞用户的_id
    likes: [
        {
            type: 'ObjectId',
            ref: 'user'
        }
    ]
});

var replyModel = mongoose.model('reply',replySchema);
module.exports = replyModel;